home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume6 / conquer4 / patch5c < prev    next >
Encoding:
Internet Message Format  |  1989-09-11  |  44.1 KB

  1. Path: uunet!zephyr.ens.tek.com!tekgen!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v08i015:  conquer4 - middle earth multi-player game (V4), Patch5c
  5. Message-ID: <4515@tekred.CNA.TEK.COM>
  6. Date: 1 Sep 89 18:54:23 GMT
  7. Sender: nobody@tekred.CNA.TEK.COM
  8. Lines: 1632
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: Adam Bryant <adb@cs.bu.edu>
  12. Posting-number: Volume 8, Issue 15
  13. Archive-name: conquer4/Patch5c
  14. Patch-To: conquer4: Volume 6, Issue 83-97
  15.  
  16.  
  17. #!/bin/sh
  18. # this is part 3 of a multipart archive
  19. # do not concatenate these parts, unpack them in order with /bin/sh
  20. # file patchV4.5 continued
  21. #
  22. CurArch=3
  23. if test ! -r s2_seq_.tmp
  24. then echo "Please unpack part 1 first!"
  25.      exit 1; fi
  26. ( read Scheck
  27.   if test "$Scheck" != $CurArch
  28.   then echo "Please unpack part $Scheck next!"
  29.        exit 1;
  30.   else exit 0; fi
  31. ) < s2_seq_.tmp || exit 1
  32. echo "x - Continuing file patchV4.5"
  33. sed 's/^X//' << 'SHAR_EOF' >> patchV4.5
  34. X+  * The following unseen (UNS_) value represents this.  
  35. X+  */
  36. X+ #define    UNS_CITY_VALUE    10    /* If there is an under-defended City
  37. X+                  * the value is 500
  38. X+                  */
  39. X+ 
  40. X  void
  41. X  prtattr()
  42. X  {
  43. X***************
  44. X*** 131,137 ****
  45. X              if( ((sct[x][y].owner) == 0
  46. X              || solds_in_sector( x, y, sct[x][y].owner) == 0 )
  47. X              && (ntn[sct[x][y].owner].active!=NPC_NOMAD) ) {
  48. X!                 fprintf(fnews,"3.\tnomads capture sector %d,%d\n",x,y);
  49. X                  if(sct[x][y].owner!=0) flee(x,y,1,FALSE);
  50. X                  sct[x][y].owner=country;
  51. X                  DEVASTATE(x,y);
  52. X--- 169,175 ----
  53. X              if( ((sct[x][y].owner) == 0
  54. X              || solds_in_sector( x, y, sct[x][y].owner) == 0 )
  55. X              && (ntn[sct[x][y].owner].active!=NPC_NOMAD) ) {
  56. X!                 fprintf(fnews,"3:\tnomads capture sector %d,%d\n",x,y);
  57. X                  if(sct[x][y].owner!=0) flee(x,y,1,FALSE);
  58. X                  sct[x][y].owner=country;
  59. X                  DEVASTATE(x,y);
  60. X***************
  61. X*** 180,186 ****
  62. X              if( ((sct[x][y].owner == 0)
  63. X              || (solds_in_sector( x, y, sct[x][y].owner) == 0))
  64. X              && (ntn[sct[x][y].owner].active != NPC_SAVAGE)) {
  65. X!                 fprintf(fnews,"3.\tsavages capture sector %d,%d\n",x,y);
  66. X                  if(P_ATYPE<MINLEADER) {
  67. X                      if(sct[x][y].owner!=0) flee(x,y,1,FALSE);
  68. X                      sct[x][y].owner=country;
  69. X--- 218,224 ----
  70. X              if( ((sct[x][y].owner == 0)
  71. X              || (solds_in_sector( x, y, sct[x][y].owner) == 0))
  72. X              && (ntn[sct[x][y].owner].active != NPC_SAVAGE)) {
  73. X!                 fprintf(fnews,"3:\tsavages capture sector %d,%d\n",x,y);
  74. X                  if(P_ATYPE<MINLEADER) {
  75. X                      if(sct[x][y].owner!=0) flee(x,y,1,FALSE);
  76. X                      sct[x][y].owner=country;
  77. X***************
  78. X*** 657,684 ****
  79. X              }
  80. X          }
  81. X          if((free==TRUE)) {
  82. X!             /* want to add ideal troops */
  83. X!             ideal = sct[x][y].people/MILINCITY - P_ASOLD;
  84. X!             ideal = min(ideal, 250);
  85. X!             if (P_ASOLD < 50)    /* make the militia at least 50 */
  86. X!                 ideal = max(ideal,50-P_ASOLD);
  87. X!             if (P_ASOLD + ideal < 50) /*don't let ideal bring it below 50*/
  88. X!                 continue;
  89. X              if(ideal>0){
  90. X              if(magic(country,WARRIOR)==TRUE){ /* WARRIOR power */
  91. X                  curntn->tgold-=
  92. X!                     (ideal* *(u_encost+P_ATYPE))/2;
  93. X              } else {
  94. X                  curntn->tgold-=
  95. X!                     ideal* *(u_encost + P_ATYPE);
  96. X              }
  97. X              }
  98. X-             P_ASOLD+=ideal;
  99. X-             P_ATYPE=A_MILITIA;
  100. X-             P_ASTAT=MILITIA;
  101. X  #ifdef DEBUG
  102. X!         printf("\tadding %ld troops to %s army %d (now %ld men - populace %ld)\n",ideal,unittype[P_ATYPE],armynum,P_ASOLD,sct[x][y].people);
  103. X  #endif DEBUG
  104. X          }
  105. X      }
  106. X      check();
  107. X--- 695,721 ----
  108. X              }
  109. X          }
  110. X          if((free==TRUE)) {
  111. X!             /* want to have ideal troops */
  112. X!             ideal = sct[x][y].people/MILINCITY;
  113. X! 
  114. X!             if(ideal < 50)    /* make the militia at least 50 */
  115. X!                 ideal = 50;
  116. X! 
  117. X              if(ideal>0){
  118. X              if(magic(country,WARRIOR)==TRUE){ /* WARRIOR power */
  119. X                  curntn->tgold-=
  120. X!                     ((ideal-P_ASOLD)* *(u_encost+P_ATYPE))/2;
  121. X              } else {
  122. X                  curntn->tgold-=
  123. X!                     (ideal-P_ASOLD)* *(u_encost + P_ATYPE);
  124. X              }
  125. X              }
  126. X  #ifdef DEBUG
  127. X!         printf("\tadding %ld troops to %s army %d (now %ld men - populace %ld)\n",ideal-P_ASOLD,unittype[P_ATYPE],armynum,ideal,sct[x][y].people);
  128. X  #endif DEBUG
  129. X+             P_ASOLD=ideal;
  130. X+             P_ATYPE=A_MILITIA;
  131. X+             P_ASTAT=MILITIA;
  132. X          }
  133. X      }
  134. X      check();
  135. X***************
  136. X*** 824,829 ****
  137. X--- 861,923 ----
  138. X      }
  139. X  }
  140. X  
  141. X+     
  142. X+ /* Find the average world food value per sector
  143. X+  * and the average tradegood value per sector.
  144. X+  * This is used for unseen sectors and unseen
  145. X+  * armies.                                                    */
  146. X+ static void
  147. X+ find_avg_sector ()
  148. X+ {
  149. X+                 int            armynum;
  150. X+                 int            i;
  151. X+                 int            nation;
  152. X+                 int            repeat;
  153. X+     struct        s_sector    *sptr;        /*    used to speed up this function    */
  154. X+     register    int            x,y;
  155. X+     register    long        total_food   = 0;
  156. X+                 int            total_sectors;
  157. X+     register    long        total_tg     = 0;
  158. X+     register    long        useable_land = 0;
  159. X+ 
  160. X+     for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++) {
  161. X+         sptr = &sct[x][y];    
  162. X+         if(( sptr->altitude!=WATER )&&( sptr->altitude!=PEAK )) {
  163. X+             useable_land++;
  164. X+             total_food += tofood(sptr,country);
  165. X+             if(sptr->tradegood != TG_none) {
  166. X+                 if(sptr->metal != 0) total_tg +=500;
  167. X+                 else if(sptr->jewels != 0) total_tg +=500;
  168. X+                 else total_tg +=300;
  169. X+             }
  170. X+         }
  171. X+     }
  172. X+     Avg_food = total_food / useable_land;
  173. X+     Avg_tradegood = total_tg / useable_land;
  174. X+ 
  175. X+     for(nation=1;nation<NTOTAL;nation++) {
  176. X+         if(isntn(ntn[nation].active)
  177. X+         && !COUNT_ARMIES(nation,country)) { 
  178. X+             /* Count the number of sectors which are occupied by each
  179. X+              * nation's armies.                                            */
  180. X+             total_sectors = 0;
  181. X+             for(armynum=1;armynum<MAXARM;armynum++)
  182. X+                 if(ntn[nation].arm[armynum].sold > 0) {
  183. X+                     x = ntn[nation].arm[armynum].xloc;
  184. X+                     y = ntn[nation].arm[armynum].yloc;
  185. X+                     repeat = FALSE;
  186. X+                     for (i=1; (i<armynum) && !repeat; ++i) 
  187. X+                         if((ntn[nation].arm[i].xloc == x)
  188. X+                         && (ntn[nation].arm[i].yloc == y)) 
  189. X+                         repeat = TRUE;    
  190. X+                     if (!repeat) 
  191. X+                         total_sectors++;
  192. X+                 }
  193. X+ 
  194. X+             Avg_soldiers[nation] = ntn[nation].tmil / total_sectors;
  195. X+         }
  196. X+     }
  197. X+ }
  198. X  void
  199. X  nationrun()
  200. X  {
  201. X***************
  202. X*** 864,869 ****
  203. X--- 958,965 ----
  204. X  
  205. X      getdstatus();
  206. X  
  207. X+     find_avg_sector ();
  208. X+ 
  209. X  #ifdef SPEW
  210. X      for(x=1;x<NTOTAL;x++) if(isntn( ntn[x].active )) {
  211. X          /* here is the bit which will occasionally send a randomly
  212. X***************
  213. X*** 1141,1147 ****
  214. X      for(x=(int)curntn->capx-4;x<=(int)curntn->capx+4;x++){
  215. X          for(y=(int)curntn->capy-4;y<=(int)curntn->capy+4;y++){
  216. X              if((ONMAP(x,y))&&(sct[x][y].owner==0)) {
  217. X!                 attr[x][y] += 700;
  218. X              }
  219. X          }
  220. X      }
  221. X--- 1237,1243 ----
  222. X      for(x=(int)curntn->capx-4;x<=(int)curntn->capx+4;x++){
  223. X          for(y=(int)curntn->capy-4;y<=(int)curntn->capy+4;y++){
  224. X              if((ONMAP(x,y))&&(sct[x][y].owner==0)) {
  225. X!                 attr[x][y] += 450;
  226. X              }
  227. X          }
  228. X      }
  229. X***************
  230. X*** 1148,1159 ****
  231. X  
  232. X      for(x=stx;x<endx;x++) {
  233. X          for(y=sty;y<endy;y++) {
  234. X!             /* add if metal high */
  235. X!             if(sct[x][y].tradegood != TG_none) {
  236. X!                 if(sct[x][y].metal != 0) attr[x][y]+=500;
  237. X!                 else if(sct[x][y].jewels != 0) attr[x][y]+=500;
  238. X!                 else attr[x][y]+=300;
  239. X              }
  240. X              /*add to attractiveness for unowned sectors*/
  241. X              if(sct[x][y].owner == 0) {
  242. X                  attr[x][y]+=300;
  243. X--- 1244,1261 ----
  244. X  
  245. X      for(x=stx;x<endx;x++) {
  246. X          for(y=sty;y<endy;y++) {
  247. X!             if (SEE_SECTOR(x,y,country)) {
  248. X!                 /* add if metal high */
  249. X!                 if(sct[x][y].tradegood != TG_none) {
  250. X!                     if(sct[x][y].metal != 0) attr[x][y]+=500;
  251. X!                     else if(sct[x][y].jewels != 0) attr[x][y]+=500;
  252. X!                     else attr[x][y]+=300;
  253. X!                 }
  254. X              }
  255. X+             else
  256. X+             /*give some value: tradegood MIGHT be there*/
  257. X+                 attr[x][y] += Avg_tradegood;
  258. X+ 
  259. X              /*add to attractiveness for unowned sectors*/
  260. X              if(sct[x][y].owner == 0) {
  261. X                  attr[x][y]+=300;
  262. X***************
  263. X*** 1161,1167 ****
  264. X              if(ntn[sct[x][y].owner].active == NPC_NOMAD)
  265. X                  attr[x][y]+=100;
  266. X              }
  267. X!             attr[x][y] += 50*tofood(&sct[x][y],country); 
  268. X  
  269. X              if(!is_habitable(x,y)) {
  270. X  #ifdef XENIX
  271. X--- 1263,1273 ----
  272. X              if(ntn[sct[x][y].owner].active == NPC_NOMAD)
  273. X                  attr[x][y]+=100;
  274. X              }
  275. X!             if (SEE_SECTOR(x,y,country)) 
  276. X!                 attr[x][y] += 50*tofood(&sct[x][y],country); 
  277. X!             else
  278. X!             /* give some value: there is probably average food there    */ 
  279. X!                 attr[x][y] += 50*Avg_food;
  280. X  
  281. X              if(!is_habitable(x,y)) {
  282. X  #ifdef XENIX
  283. X***************
  284. X*** 1175,1192 ****
  285. X          }
  286. X      }
  287. X  }
  288. X  void
  289. X  n_defend(natn)
  290. X  register short natn;
  291. X  {
  292. X!     int x,y;
  293. X  
  294. X!     /* add 1/10th of their soldiers in sector */
  295. X!     for(x=1;x<MAXARM;x++) if(ntn[natn].arm[x].sold > 0)
  296. X!         if(sct[ntn[natn].arm[x].xloc][ntn[natn].arm[x].yloc].owner==country)
  297. X!             attr[ntn[natn].arm[x].xloc][ntn[natn].arm[x].yloc] +=
  298. X!                 ntn[natn].arm[x].sold/10;
  299. X  
  300. X      /*plus 80 if near your capitol */
  301. X      for(x=(int)curntn->capx-1;x<=(int)curntn->capy+1;x++){
  302. X          for(y=(int)curntn->capy-1;y<=(int)curntn->capy+1;y++){
  303. X--- 1281,1324 ----
  304. X          }
  305. X      }
  306. X  }
  307. X+ 
  308. X  void
  309. X  n_defend(natn)
  310. X  register short natn;
  311. X  {
  312. X!     register    int        i,j;
  313. X!                 int        repeat;
  314. X!     register    int        x,y;
  315. X  
  316. X!     if (COUNT_ARMIES(natn,country)) {
  317. X!         /* add 1/10th of their soldiers in sector */
  318. X!         for(x=1;x<MAXARM;x++) if(ntn[natn].arm[x].sold > 0)
  319. X!             if(sct[ntn[natn].arm[x].xloc][ntn[natn].arm[x].yloc].owner==country)
  320. X!                 attr[ntn[natn].arm[x].xloc][ntn[natn].arm[x].yloc] +=
  321. X!                     ntn[natn].arm[x].sold/10;
  322. X!     }
  323. X!     else {
  324. X!         /* For every of this country's sectors that has a 'natn' army
  325. X!          * in it, add 1/10 of the average number of soldiers in that
  326. X!          * 'natn' army.
  327. X!          */
  328. X!         for(j=1;j<MAXARM;j++) if(ntn[natn].arm[j].sold > 0) {
  329. X!             x = ntn[natn].arm[j].xloc;
  330. X!             y = ntn[natn].arm[j].yloc;
  331. X!             if(sct[x][y].owner==country) {
  332. X!                 /* insure the average soldiers is only added
  333. X!                  * once per sector                                */
  334. X!                 repeat = FALSE;
  335. X!                 for (i=1; (i<j) && !repeat; ++i) 
  336. X!                     if((ntn[natn].arm[i].xloc == x)
  337. X!                     && (ntn[natn].arm[i].yloc == y)) 
  338. X!                         repeat = TRUE;    
  339. X  
  340. X+                 if (!repeat) 
  341. X+                     attr[x][y] += Avg_soldiers[natn]/10;
  342. X+             }
  343. X+         }
  344. X+     }
  345. X      /*plus 80 if near your capitol */
  346. X      for(x=(int)curntn->capx-1;x<=(int)curntn->capy+1;x++){
  347. X          for(y=(int)curntn->capy-1;y<=(int)curntn->capy+1;y++){
  348. X***************
  349. X*** 1218,1235 ****
  350. X      long    solds;    /* solds within 1 of capitol or city */
  351. X  
  352. X      for(x=stx;x<endx;x++) for(y=sty;y<endy;y++){
  353. X!         if((sct[x][y].owner==nation)&&
  354. X!         ((sct[x][y].designation==DCITY)
  355. X!         ||(sct[x][y].designation==DCAPITOL)
  356. X!         ||(sct[x][y].designation==DTOWN))){
  357. X!             solds=0;
  358. X!             for(armynum=1;armynum<MAXARM;armynum++) 
  359. X!                 if((ntn[country].arm[armynum].sold > 0)
  360. X!                 &&(abs(AXLOC-x)<=1)
  361. X!                 &&(abs(AYLOC-y)<=1)) solds+=ASOLD;
  362. X! 
  363. X!             if(solds_in_sector(x,y,nation)*2 < 3*solds)
  364. X!                 attr[x][y]+=500;
  365. X          }
  366. X      }
  367. X  }
  368. X--- 1350,1380 ----
  369. X      long    solds;    /* solds within 1 of capitol or city */
  370. X  
  371. X      for(x=stx;x<endx;x++) for(y=sty;y<endy;y++){
  372. X!         if(sct[x][y].owner==nation) {
  373. X!             if(SEE_CITIES(nation,country)) {
  374. X!                 if (((sct[x][y].designation==DCITY)
  375. X!                 ||(sct[x][y].designation==DCAPITOL)
  376. X!                 ||(sct[x][y].designation==DTOWN))){
  377. X!                     solds=0;
  378. X!                     for(armynum=1;armynum<MAXARM;armynum++) 
  379. X!                         if((ntn[country].arm[armynum].sold > 0)
  380. X!                         &&(abs(AXLOC-x)<=1)
  381. X!                         &&(abs(AYLOC-y)<=1)) solds+=ASOLD;
  382. X!         
  383. X!                     if (COUNT_ARMIES(nation,country)) {
  384. X!                         if(solds_in_sector(x,y,nation)*2 < 3*solds)
  385. X!                             attr[x][y]+=500;
  386. X!                     }
  387. X!                     else {
  388. X!                         if((solds_in_sector(x,y,nation) != 0)
  389. X!                         &&(Avg_soldiers[nation]*2 < 3*solds))
  390. X!                             attr[x][y]+=400;
  391. X!                     }
  392. X!                 }
  393. X!             }
  394. X!             else
  395. X!             /* Give some value: the sector MIGHT be an under-defended city    */
  396. X!                 attr[x][y] += UNS_CITY_VALUE;
  397. X          }
  398. X      }
  399. X  }
  400. X***************
  401. X*** 1273,1278 ****
  402. X--- 1418,1426 ----
  403. X  {
  404. X      int x1,x2,y1,y2,x,y;
  405. X  
  406. X+     if (SEE_CITIES(nation,country)==FALSE)
  407. X+         return;
  408. X+ 
  409. X      /*plus if strategic blocking sector*/
  410. X  
  411. X      /*+60 if between the two capitol*/
  412. X***************
  413. X*** 1304,1311 ****
  414. X--- 1452,1462 ----
  415. X  void
  416. X  n_survive()
  417. X  {
  418. X+     int i;
  419. X      int nation,armynum;
  420. X      int capx,capy;
  421. X+     int    repeat;
  422. X+     int x,y;
  423. X  
  424. X      capx=curntn->capx;
  425. X      capy=curntn->capy;
  426. X***************
  427. X*** 1315,1336 ****
  428. X      }
  429. X  
  430. X      /*defend your capitol if occupied, +50 more if with their army*/
  431. X!     for(nation=1;nation<NTOTAL;nation++)
  432. X      if((isntn(ntn[nation].active))
  433. X      &&((ntn[nation].dstatus[country]>=WAR)
  434. X        ||(curntn->dstatus[nation]>=WAR))){
  435. X!         for(armynum=1;armynum<MAXARM;armynum++)
  436. X!         if((ntn[nation].arm[armynum].sold > 0) 
  437. X!         &&( ntn[nation].arm[armynum].xloc<=capx+2)
  438. X!         &&( ntn[nation].arm[armynum].xloc>=capx-2)
  439. X!         &&( ntn[nation].arm[armynum].yloc<=capy+2)
  440. X!         &&( ntn[nation].arm[armynum].yloc>=capy-2)){
  441. X!             if((ntn[nation].arm[armynum].xloc==capx)
  442. X!             &&(ntn[nation].arm[armynum].yloc==capy)){
  443. X!                 attr[capx][capy]+=2*ntn[nation].arm[armynum].sold;
  444. X!             } else {
  445. X!                 attr[ntn[nation].arm[armynum].xloc][ntn[nation].arm[armynum].yloc]+=ntn[nation].arm[armynum].sold;
  446. X              }
  447. X          }
  448. X      }
  449. X  }
  450. X--- 1466,1520 ----
  451. X      }
  452. X  
  453. X      /*defend your capitol if occupied, +50 more if with their army*/
  454. X!     for(nation=1;nation<NTOTAL;nation++) 
  455. X      if((isntn(ntn[nation].active))
  456. X      &&((ntn[nation].dstatus[country]>=WAR)
  457. X        ||(curntn->dstatus[nation]>=WAR))){
  458. X!         if (COUNT_ARMIES(nation,country)) {
  459. X!             for(armynum=1;armynum<MAXARM;armynum++)
  460. X!             if((ntn[nation].arm[armynum].sold > 0) 
  461. X!             &&( ntn[nation].arm[armynum].xloc<=capx+2)
  462. X!             &&( ntn[nation].arm[armynum].xloc>=capx-2)
  463. X!             &&( ntn[nation].arm[armynum].yloc<=capy+2)
  464. X!             &&( ntn[nation].arm[armynum].yloc>=capy-2)){
  465. X!                 if((ntn[nation].arm[armynum].xloc==capx)
  466. X!                 &&(ntn[nation].arm[armynum].yloc==capy)){
  467. X!                     attr[capx][capy]+=2*ntn[nation].arm[armynum].sold;
  468. X!                 }
  469. X!                 else {
  470. X!                     attr[ntn[nation].arm[armynum].xloc][ntn[nation].arm[armynum].yloc]+=ntn[nation].arm[armynum].sold;
  471. X!                 }
  472. X              }
  473. X+         } else {
  474. X+         /* The next line might be more accurate to take into account
  475. X+          * the actual number of armies that natn has, but I don't
  476. X+          * think that VOID or HIDDEN should allow that to be known.
  477. X+          */
  478. X+             for(armynum=1;armynum<MAXARM;armynum++)
  479. X+             if(ntn[nation].arm[armynum].sold > 0) {
  480. X+                 x = ntn[nation].arm[armynum].xloc;
  481. X+                 y = ntn[nation].arm[armynum].yloc;
  482. X+                 if((capx-2<=x && x<=capx+2)
  483. X+                 &&( capy-2<=y && y<=capy+2)){
  484. X+                 /* insure the average soldiers is only added
  485. X+                  * once per sector
  486. X+                  */
  487. X+                     repeat = FALSE;
  488. X+                     for (i=1; (i<armynum) && !repeat; ++i) 
  489. X+                         if((ntn[nation].arm[i].xloc == x)
  490. X+                         && (ntn[nation].arm[i].yloc == y)) 
  491. X+                         repeat = TRUE;    
  492. X+                     if (!repeat) {
  493. X+                         if((ntn[nation].arm[armynum].xloc==capx)
  494. X+                         &&(ntn[nation].arm[armynum].yloc==capy)){
  495. X+                             attr[capx][capy]+=2* Avg_soldiers[nation];
  496. X+                         } 
  497. X+                         else {
  498. X+                             attr[ntn[nation].arm[armynum].xloc][ntn[nation].arm[armynum].yloc]+= Avg_soldiers[nation];
  499. X+                         }
  500. X+                     }
  501. X+                 }
  502. X+             }
  503. X          }
  504. X      }
  505. X  }
  506. X***************
  507. X*** 1399,1404 ****
  508. X--- 1583,1589 ----
  509. X  #ifdef DEBUG
  510. X      printf("pceattr()\n");
  511. X  #endif DEBUG
  512. X+     n_unowned();
  513. X      n_unowned();
  514. X      n_unowned();
  515. X      n_trespass();
  516. X*** onations    Sat Aug 26 19:04:07 1989
  517. X--- nations    Sat Aug 26 19:04:24 1989
  518. X***************
  519. X*** 50,56 ****
  520. X  #########################################################################
  521. X  argos    The_Ed     H A F 10 10  9  50000  1000 60 8  i -1 -1 1
  522. X  anorian  Anudil     E a F 30 40  8  70000  1500 60 8  g -1 -1 3
  523. X! bobland  Dogon      O B G 20 0   6  12000  1500 70 13 i -1 -1 9
  524. X  darboth  balrog     O D R 0  0   7  70000  1500 70 12 e -1 -1 8
  525. X  edland   Debbra     H E R 10 15  12 30000  1000 60 8  g -1 -1 1
  526. X  fung     Fungus     E F G 10 40  8  50000  1000 70 8  i -1 -1 1
  527. X--- 50,56 ----
  528. X  #########################################################################
  529. X  argos    The_Ed     H A F 10 10  9  50000  1000 60 8  i -1 -1 1
  530. X  anorian  Anudil     E a F 30 40  8  70000  1500 60 8  g -1 -1 3
  531. X! bobland  Dogon      O B G 20 0   6  12000  1500 70 12 i -1 -1 9
  532. X  darboth  balrog     O D R 0  0   7  70000  1500 70 12 e -1 -1 8
  533. X  edland   Debbra     H E R 10 15  12 30000  1000 60 8  g -1 -1 1
  534. X  fung     Fungus     E F G 10 40  8  50000  1000 70 8  i -1 -1 1
  535. X***************
  536. X*** 57,69 ****
  537. X  goldor   Train      D G F 10 15  8  30000  1000 70 8  n -1 -1 2
  538. X  haro     Cesear     H H R 10 10  9  30000  1500 60 7  i -1 -1 1
  539. X  jodoba   Ganalf     H J R 10 10  2  30000  1500 60 8  n -1 -1 3
  540. X! lint     Lynne      E L F 20 30  8  50000  1500 70 10 g -1 -1 3
  541. X  muldor   Gilur      D M F 10 30  6  160000 1500 70 9  n -1 -1 1
  542. X! noria    Gloin      D N R 10 30  6  50000  1000 60 8  n -1 -1 1
  543. X  tokus    Sumu       H T R 10 10  8  30000  1000 60 8  e -1 -1 1
  544. X! woooo    Nastus     O W F 10 10  10 60000  3500 75 13 e -1 -1 10
  545. X! zaos     Dragonus   O Z R 20 0   8  12000  1500 70 14 e -1 -1 9
  546. X  frika    Frik       D f F 10 10  8  50000  1200 60 10 n -1 -1 1
  547. X  amazon   Diana      E X F 10 10  8  50000  1200 60 10 e -1 -1 2
  548. X! tasman   Obilisk    H t F 10 10  8  50000  1200 60 10 g -1 -1 3
  549. X  sahara   Barbar     H S F 10 10  8  50000  1200 60 10 i -1 -1 4
  550. X--- 57,69 ----
  551. X  goldor   Train      D G F 10 15  8  30000  1000 70 8  n -1 -1 2
  552. X  haro     Cesear     H H R 10 10  9  30000  1500 60 7  i -1 -1 1
  553. X  jodoba   Ganalf     H J R 10 10  2  30000  1500 60 8  n -1 -1 3
  554. X! #lint     Lynne      E L F 20 30  8  50000  1500 70 10 g -1 -1 3
  555. X  muldor   Gilur      D M F 10 30  6  160000 1500 70 9  n -1 -1 1
  556. X! #noria    Gloin      D N R 10 30  6  50000  1000 60 8  n -1 -1 1
  557. X  tokus    Sumu       H T R 10 10  8  30000  1000 60 8  e -1 -1 1
  558. X! woooo    Nastus     O W F 10 10  10 60000  3500 75 11 e -1 -1 10
  559. X! #zaos     Dragonus   O Z R 20 0   8  12000  1500 70 12 e -1 -1 9
  560. X  frika    Frik       D f F 10 10  8  50000  1200 60 10 n -1 -1 1
  561. X  amazon   Diana      E X F 10 10  8  50000  1200 60 10 e -1 -1 2
  562. X! #tasman   Obilisk    H t F 10 10  8  50000  1200 60 10 g -1 -1 3
  563. X  sahara   Barbar     H S F 10 10  8  50000  1200 60 10 i -1 -1 4
  564. X*** onavy.c    Sat Aug 26 19:04:07 1989
  565. X--- navy.c    Sat Aug 26 19:04:25 1989
  566. X***************
  567. X*** 423,429 ****
  568. X              }
  569. X              P_ASTAT=DEFEND;
  570. X              P_NARMY=MAXARM;
  571. X!             P_NMOVE=0;
  572. X              NADJMOV;
  573. X              NADJHLD;
  574. X              AADJSTAT;
  575. X--- 423,435 ----
  576. X              }
  577. X              P_ASTAT=DEFEND;
  578. X              P_NARMY=MAXARM;
  579. X!             if ((sct[XREAL][YREAL].designation!=DCITY
  580. X!             && sct[XREAL][YREAL].designation!=DCAPITOL)
  581. X!             || P_NMOVE < N_CITYCOST) {
  582. X!                 P_NMOVE=0;
  583. X!             } else {
  584. X!                 P_NMOVE-= N_CITYCOST;
  585. X!             }
  586. X              NADJMOV;
  587. X              NADJHLD;
  588. X              AADJSTAT;
  589. X***************
  590. X*** 445,451 ****
  591. X                  sct[XREAL][YREAL].people += amount;
  592. X                  P_NPEOP=(unsigned char)((mhold*P_NPEOP-amount)/mhold);
  593. X                  NADJHLD;
  594. X!                 P_NMOVE=0;
  595. X                  NADJMOV;
  596. X                  SADJCIV;
  597. X              }
  598. X--- 451,463 ----
  599. X                  sct[XREAL][YREAL].people += amount;
  600. X                  P_NPEOP=(unsigned char)((mhold*P_NPEOP-amount)/mhold);
  601. X                  NADJHLD;
  602. X!                 if ((sct[XREAL][YREAL].designation!=DCITY
  603. X!                 && sct[XREAL][YREAL].designation!=DCAPITOL)
  604. X!                 || P_NMOVE < N_CITYCOST) {
  605. X!                     P_NMOVE=0;
  606. X!                 } else {
  607. X!                     P_NMOVE-= N_CITYCOST;
  608. X!                 }
  609. X                  NADJMOV;
  610. X                  SADJCIV;
  611. X              }
  612. X***************
  613. X*** 483,489 ****
  614. X                  P_ASTAT=ONBOARD;
  615. X                  P_AMOVE=0;
  616. X                  P_NARMY=armynum;
  617. X!                 P_NMOVE=0;
  618. X                  NADJMOV;
  619. X                  NADJHLD;
  620. X                  AADJMOV;
  621. X--- 495,507 ----
  622. X                  P_ASTAT=ONBOARD;
  623. X                  P_AMOVE=0;
  624. X                  P_NARMY=armynum;
  625. X!                 if ((sct[XREAL][YREAL].designation!=DCITY
  626. X!                 && sct[XREAL][YREAL].designation!=DCAPITOL)
  627. X!                 || P_NMOVE < N_CITYCOST) {
  628. X!                     P_NMOVE=0;
  629. X!                 } else {
  630. X!                     P_NMOVE-= N_CITYCOST;
  631. X!                 }
  632. X                  NADJMOV;
  633. X                  NADJHLD;
  634. X                  AADJMOV;
  635. X***************
  636. X*** 503,509 ****
  637. X                  sct[XREAL][YREAL].people -= amount;
  638. X                  P_NPEOP += (unsigned char)(amount / mhold);
  639. X                  SADJCIV;
  640. X!                 P_NMOVE=0;
  641. X                  NADJMOV;
  642. X                  NADJHLD;
  643. X              }
  644. X--- 521,533 ----
  645. X                  sct[XREAL][YREAL].people -= amount;
  646. X                  P_NPEOP += (unsigned char)(amount / mhold);
  647. X                  SADJCIV;
  648. X!                 if ((sct[XREAL][YREAL].designation!=DCITY
  649. X!                 && sct[XREAL][YREAL].designation!=DCAPITOL)
  650. X!                 || P_NMOVE < N_CITYCOST) {
  651. X!                     P_NMOVE=0;
  652. X!                 } else {
  653. X!                     P_NMOVE-= N_CITYCOST;
  654. X!                 }
  655. X                  NADJMOV;
  656. X                  NADJHLD;
  657. X              }
  658. X*** otxt0    Sat Aug 26 19:04:08 1989
  659. X--- txt0    Sat Aug 26 19:04:25 1989
  660. X***************
  661. X*** 17,23 ****
  662. X  'S': diplomacy status        MISC COMMANDS         'a': army report
  663. X                             'q': quit and save      'f': fleet report
  664. X        VISUAL               'v': version credits    'g': group army report
  665. X! 'd': change display        'Q': quit and save      'w': wizardry commands
  666. X  'cntrl-L': redraw          '?': help screens     'ESC': extra commands
  667. X  END
  668. X                        CONQUER EXTENDED COMMANDS
  669. X--- 17,23 ----
  670. X  'S': diplomacy status        MISC COMMANDS         'a': army report
  671. X                             'q': quit and save      'f': fleet report
  672. X        VISUAL               'v': version credits    'g': group army report
  673. X! 'd': change display        '!': repeat unit cmd    'w': wizardry commands
  674. X  'cntrl-L': redraw          '?': help screens     'ESC': extra commands
  675. X  END
  676. X                        CONQUER EXTENDED COMMANDS
  677. X***************
  678. X*** 65,74 ****
  679. X  
  680. X        To facilitate the use of conquer, the environment variable
  681. X  XCONQENV has been added to conquer to allow settings of default options
  682. X! to conquer.  Just add a line to your .cshrc or .login file with the
  683. X! following format:
  684. X  
  685. X! setenv XCONQENV "G,nation=MyLand,datadir=this_game"
  686. X  
  687. X        If you then type just 'conquer' to enter conquer, it will be
  688. X  equivalent to typing 'conquer -G -n MyLand -d this_game'.
  689. X--- 65,75 ----
  690. X  
  691. X        To facilitate the use of conquer, the environment variable
  692. X  XCONQENV has been added to conquer to allow settings of default options
  693. X! to conquer.  Just add a line to your .cshrc or .login (BSD) or .profile (SYSV)
  694. X! file with the following format:
  695. X  
  696. X! setenv XCONQENV "G,nation=MyLand,datadir=this_game" (BSD)
  697. X! XCONQENV="G,nation=MyLand,datadir=this_game" (SYSV)
  698. X  
  699. X        If you then type just 'conquer' to enter conquer, it will be
  700. X  equivalent to typing 'conquer -G -n MyLand -d this_game'.
  701. X*** otxt2    Sat Aug 26 19:04:08 1989
  702. X--- txt2    Sat Aug 26 19:04:26 1989
  703. X***************
  704. X*** 192,199 ****
  705. X  Medium          Two             +XSIZESPD            2 x Base
  706. X  Heavy           Three           +0            3 x Base
  707. X  
  708. X! Ship maintenance will cost XSHIPMAINT per holding space
  709. X! on each update.
  710. X  END
  711. X                             SHIP INFORMATION
  712. X  
  713. X--- 192,199 ----
  714. X  Medium          Two             +XSIZESPD            2 x Base
  715. X  Heavy           Three           +0            3 x Base
  716. X  
  717. X! Ship maintenance will cost XSHIPMAINT per holding space on each update.
  718. X! (Un)loading costs XNCITYCOST movement in cities, full movement elsewhere.
  719. X  END
  720. X                             SHIP INFORMATION
  721. X  
  722. X*** otxt5    Sat Aug 26 19:04:08 1989
  723. X--- txt5    Sat Aug 26 19:04:26 1989
  724. X***************
  725. X*** 114,120 ****
  726. X  produces 3 points of popularity.  Special display and redesignation options
  727. X  will help you redesignate sectors to use the tradegood you desire.
  728. X  
  729. X! popularity     fur(1,any),wool(3,farm),beer(3,farm),cloth(3,farm),wine(5,farm)
  730. X  communications mules(1,town),horses(5,town),pigeons(7,town),griffons(9,town)
  731. X  spoilrate      pottery(1,town),salt(3,mine),timber(1,lumberyard),
  732. X                 granite(1,mine),pine(3,lumberyd),oak(5,lumberyd),nails(7,town)
  733. X--- 114,120 ----
  734. X  produces 3 points of popularity.  Special display and redesignation options
  735. X  will help you redesignate sectors to use the tradegood you desire.
  736. X  
  737. X! popularity     fur(2,any),wool(5,farm),beer(6,farm),cloth(6,farm),wine(9,farm)
  738. X  communications mules(1,town),horses(5,town),pigeons(7,town),griffons(9,town)
  739. X  spoilrate      pottery(1,town),salt(3,mine),timber(1,lumberyard),
  740. X                 granite(1,mine),pine(3,lumberyd),oak(5,lumberyd),nails(7,town)
  741. X***************
  742. X*** 204,209 ****
  743. X--- 204,210 ----
  744. X                100-wealth/4.  Charity is a user paramter, which indicates the
  745. X                percent of your NET income to go to the poor.  Giving twice your
  746. X                population in talons will reduce poverty by one.
  747. X+ wealth      : see elsewhere.
  748. X  END
  749. X                  ADDITIONAL MODIFIERS TO NATIONAL ATTRIBUTES
  750. X  
  751. SHAR_EOF
  752. echo "File patchV4.5 is complete"
  753. chmod 0666 patchV4.5 || echo "restore of patchV4.5 fails"
  754. set `wc -c patchV4.5`;Sum=$1
  755. if test "$Sum" != "111877"
  756. then echo original size 111877, current size $Sum;fi
  757. echo "x - extracting psmap.c (Text)"
  758. sed 's/^X//' << 'SHAR_EOF' > psmap.c &&
  759. X
  760. X/*
  761. X * A program to convert conquer-maps to postscript Feel free to hack'n slash
  762. X * Comments should be sent to  d8forma@dtek.chalmers.se
  763. X * 
  764. X */
  765. X
  766. X#include <stdio.h>
  767. X#include "psmap.h"
  768. X
  769. Xchar buffer[BUFSIZ];
  770. Xint c, xsize, ysize;
  771. Xint xmin, ymin, xmax, ymax, centx, centy;
  772. XFILE *infile, *outfile, *fh, *fopen();
  773. Xint grid = TRUE, sqsize = 9, maptype = SIMPLE, onepage = FALSE;
  774. Xint verbose = FALSE, coords = TRUE, center = TRUE, note = FALSE;
  775. Xint pagewidth, pageheight, xoffset, yoffset;
  776. Xchar title[81] = "", foot[81], fontname[81];
  777. Xchar progname[80];
  778. X
  779. Xint
  780. Xparsepagesize(buf)
  781. X    char *buf;
  782. X{
  783. X    if (!strcmp(buf, "A4"))
  784. X    return (1);
  785. X    if (!strcmp(buf, "a4"))
  786. X    return (1);
  787. X    if (!strcmp(buf, "LETTER"))
  788. X    return (2);
  789. X    if (!strcmp(buf, "letter"))
  790. X    return (2);
  791. X    return (0);
  792. X}
  793. X
  794. Xvoid
  795. Xsetpagesize(defpag)
  796. X    int defpag;
  797. X{
  798. X    switch (defpag) {
  799. X    case 1:
  800. X    pagewidth = PAGEWIDTH_A4;
  801. X    pageheight = PAGEHEIGHT_A4;
  802. X    xoffset = XOFFSET_A4;
  803. X    yoffset = YOFFSET_A4;
  804. X    break;
  805. X    case 2:
  806. X    pagewidth = PAGEWIDTH_LETTER;
  807. X    pageheight = PAGEHEIGHT_LETTER;
  808. X    xoffset = XOFFSET_LETTER;
  809. X    yoffset = YOFFSET_LETTER;
  810. X    break;
  811. X    default:
  812. X    pagewidth = PAGEWIDTH_OTHER;
  813. X    pageheight = PAGEHEIGHT_OTHER;
  814. X    xoffset = XOFFSET_OTHER;
  815. X    yoffset = YOFFSET_OTHER;
  816. X    break;
  817. X    }
  818. X}
  819. X
  820. Xvoid
  821. Xget_pagesize()
  822. X{
  823. X    char *buf;
  824. X    int defpag = DEFAULTPAGE;
  825. X
  826. X    buf = (char *) getenv("CONQ_PSMAPDEFAULTPAGE");
  827. X    if (buf != NULL)
  828. X    defpag = parsepagesize(buf);
  829. X    setpagesize(defpag);
  830. X}
  831. X
  832. Xvoid
  833. Xpsstring(fh, str)
  834. X    FILE *fh;
  835. X    char *str;
  836. X{
  837. X    fprintf(fh, "(");
  838. X    while (*str != NULL) {
  839. X    switch (*str) {
  840. X    case ('('):
  841. X        fprintf(fh, "\\(");
  842. X        break;
  843. X    case (')'):
  844. X        fprintf(fh, "\\)");
  845. X        break;
  846. X    case ('\\'):
  847. X        fprintf(fh, "\\\\");
  848. X        break;
  849. X    case ('\n'):
  850. X    case ('\f'):
  851. X        break;
  852. X    default:
  853. X        fputc(*str, fh);
  854. X        break;
  855. X    }
  856. X    str++;
  857. X    }
  858. X    fprintf(fh, ")");
  859. X}
  860. X
  861. Xint
  862. Xisinstr(string, word)
  863. X    char *string, *word;
  864. X{
  865. X    while ((c = index(string, *word)) != 0)
  866. X    if (!strncmp((char *) c, word, strlen(word))) {
  867. X        return (TRUE);
  868. X    } else
  869. X        string = (char *) c + 1;
  870. X    return (FALSE);
  871. X}
  872. X
  873. Xint
  874. Xgetmaptype(string)
  875. X    char *string;
  876. X{
  877. X    if (isinstr(string, "Altitude"))
  878. X    return (ALTITUDES);
  879. X    if (isinstr(string, "Designation"))
  880. X    return (DESIGNATIONS);
  881. X    if (isinstr(string, "Nation"))
  882. X    return (NATIONS);
  883. X    if (isinstr(string, "Vegetation"))
  884. X    return (VEGETATIONS);
  885. X    return (SIMPLE);
  886. X}
  887. X
  888. Xvoid
  889. Xreadmap()
  890. X{
  891. X    int x, none;
  892. X
  893. X    /*
  894. X     * Now we read the map. Anybody got an idea how big it is ? I don't, but
  895. X     * who cares ?
  896. X     */
  897. X
  898. X    x = 0;
  899. X    xsize = 0;
  900. X    ysize = 0;
  901. X    xmin = 0xffffff;
  902. X    xmax = (-1);
  903. X    ymin = (-1);
  904. X    ymax = 0;
  905. X    none = TRUE;
  906. X
  907. X    fprintf(outfile, "/Map [\n");
  908. X
  909. X    while ((c = fgetc(infile)) != EOF) {
  910. X    switch (c) {
  911. X    case ('\n'):
  912. X        if (xsize == 0)
  913. X        xsize = x;
  914. X        if (xsize != x) {
  915. X        fprintf(stderr, "Error in map-file. Lines different length\n");
  916. X        exit(1);
  917. X        }
  918. X        x = 0;
  919. X        if ((xmax > -1) && (ymin == -1))
  920. X        ymin = ysize;
  921. X        ysize++;
  922. X        fprintf(outfile, ")\n");
  923. X        none = TRUE;
  924. X        break;
  925. X    case (' '):
  926. X        x++;
  927. X        if (none) {
  928. X        fprintf(outfile, "(");
  929. X        none = FALSE;
  930. X        }
  931. X        fprintf(outfile, " ");
  932. X        break;
  933. X    default:
  934. X        if (x < xmin)
  935. X        xmin = x;
  936. X        if (x > xmax)
  937. X        xmax = x;
  938. X        if (ysize > ymax)
  939. X        ymax = ysize;
  940. X        x++;
  941. X        if (none) {
  942. X        fprintf(outfile, "(");
  943. X        none = FALSE;
  944. X        }
  945. X        fprintf(outfile, "%c", c);
  946. X        break;
  947. X    }
  948. X    }
  949. X
  950. X    fprintf(outfile, "] def\n\n");
  951. X
  952. X    /* Did I get anything ? */
  953. X    if (xmax == -1) {
  954. X    fprintf(stderr, "Empty input file\n");
  955. X    exit(1);
  956. X    }
  957. X    if (verbose) {
  958. X    fprintf(stderr, "Map is %d * %d  squares\n", xsize, ysize);
  959. X    fprintf(stderr, "You can see %d * %d  squares\n",
  960. X        xmax - xmin + 1, ymax - ymin + 1);
  961. X    }
  962. X}
  963. X
  964. Xvoid
  965. Xbuildps()
  966. X{
  967. X    int xbeg, ybeg, xnumb, ynumb, x, y, xpages, ypages, xcorr, ycorr;
  968. X
  969. X    /*
  970. X     * The map should be dumped to the outfile now. Maybe we should tell the
  971. X     * printer what to do with it?
  972. X     */
  973. X
  974. X    xpages = 1 + (xmax - xmin) * sqsize / (pagewidth - XMARGINS);
  975. X    ypages = 1 + (ymax - ymin) * sqsize / (pageheight - YMARGINS);
  976. X
  977. X    if (verbose)
  978. X    fprintf(stderr, "The map will be %d * %d pages\n", xpages, ypages);
  979. X
  980. X    fprintf(outfile, "/xmin %d def\n", xmin);
  981. X    fprintf(outfile, "/ymin %d def\n", ymin);
  982. X    fprintf(outfile, "/xmax %d def\n", xmax);
  983. X    fprintf(outfile, "/ymax %d def\n", ymax);
  984. X    fprintf(outfile, "/xpages %d def\n", xpages);
  985. X    fprintf(outfile, "/ypages %d def\n", ypages);
  986. X    fprintf(outfile, "/sqsize %d def\n", sqsize);
  987. X    fprintf(outfile, "/title ");
  988. X    psstring(outfile, title);
  989. X    fprintf(outfile, " def\n");
  990. X    fprintf(outfile, "/foot ");
  991. X    psstring(outfile, foot);
  992. X    fprintf(outfile, " def\n");
  993. X    fprintf(outfile, "/foot2 (ConqPS Version %s) def\n", VERSION);
  994. X    fprintf(outfile, "/PAGEWIDTH %d def\n", pagewidth);
  995. X    fprintf(outfile, "/PAGEHEIGHT %d def\n", pageheight);
  996. X    fprintf(outfile, "/XMARGINS %d def\n", XMARGINS);
  997. X    fprintf(outfile, "/YMARGINS %d def\n", YMARGINS);
  998. X    fprintf(outfile, "/XOFFSET %d def\n", xoffset);
  999. X    fprintf(outfile, "/YOFFSET %d def\n", yoffset);
  1000. X    fprintf(outfile, "/maptype %d def\n", maptype);
  1001. X    fprintf(outfile, "/font /%s def\n", fontname);
  1002. X    fprintf(outfile, "/grid ");
  1003. X    if (grid) {
  1004. X    fprintf(outfile, "true def\n");
  1005. X    } else
  1006. X    fprintf(outfile, "false def\n");
  1007. X    fprintf(outfile, "/coords ");
  1008. X    if (coords) {
  1009. X    fprintf(outfile, "true def\n");
  1010. X    } else
  1011. X    fprintf(outfile, "false def\n");
  1012. X    fprintf(outfile, "/noteq ");
  1013. X    if (note) {
  1014. X    fprintf(outfile, "true def\n");
  1015. X    } else
  1016. X    fprintf(outfile, "false def\n");
  1017. X
  1018. X    fprintf(outfile, "\n\n");
  1019. X
  1020. X    fh = fopen(PSFILE, "r");
  1021. X
  1022. X    if (fh == NULL) {
  1023. X    perror(progname);
  1024. X    exit(-10);
  1025. X    }
  1026. X    while ((c = fgetc(fh)) != EOF)
  1027. X    fputc(c, outfile);
  1028. X
  1029. X    fclose(fh);
  1030. X
  1031. X    fprintf(outfile, "\n %% Here we start the magic\n");
  1032. X
  1033. X    xnumb = (int) ((pagewidth - XMARGINS) / sqsize);
  1034. X    ynumb = (int) ((pageheight - YMARGINS) / sqsize);
  1035. X
  1036. X    if (center) {
  1037. X    xcorr = (int) ((xpages * xnumb - (xmax - xmin)) / 2);
  1038. X    ycorr = (int) ((ypages * ynumb - (ymax - ymin)) / 2);
  1039. X    } else {
  1040. X    xcorr = 0;
  1041. X    ycorr = 0;
  1042. X    }
  1043. X
  1044. X    if (onepage) {
  1045. X    fprintf(outfile, "%d %d %d %d %d %d DoPage\n",
  1046. X        1, 1, centx - xnumb / 2, xnumb, centy - ynumb / 2, ynumb);
  1047. X    } else
  1048. X    for (x = 0; x < xpages; x++)
  1049. X        for (y = 0; y < ypages; y++) {
  1050. X        xbeg = x * xnumb + x + xmin - xcorr;
  1051. X        ybeg = y * ynumb + y + ymin - ycorr;
  1052. X        fprintf(outfile, "%d %d %d %d %d %d DoPage\n",
  1053. X            x + 1, y + 1, xbeg, xnumb, ybeg, ynumb);
  1054. X        }
  1055. X}
  1056. X
  1057. Xmain(argc, argv)
  1058. X    int argc;
  1059. X    char **argv;
  1060. X{
  1061. X    extern char *optarg;
  1062. X    extern int optind;
  1063. X    char *buf, firstline[81];
  1064. X
  1065. X    strcpy(progname, argv[0]);
  1066. X    infile = stdin;
  1067. X    outfile = stdout;
  1068. X    buf = (char *) getenv("CONQ_PSFONT");
  1069. X    if (buf != NULL) {
  1070. X    strncpy(fontname, buf, 80);
  1071. X    fontname[79] = '\0';
  1072. X    } else
  1073. X    strcpy(fontname, "Times-Roman");
  1074. X    get_pagesize();
  1075. X
  1076. X    while ((c = getopt(argc, argv, "nuf:gs:t:vcho:p:lW:L:X:Y:")) != -1)
  1077. X    switch (c) {
  1078. X    case 'h':
  1079. X        fprintf(stderr, "%s version %s\n", progname, VERSION);
  1080. X        fprintf(stderr, "Default pagesize is ");
  1081. X        switch (DEFAULTPAGE) {
  1082. X        case 1:
  1083. X        fprintf(stderr, "A4\n");
  1084. X        break;
  1085. X        case 2:
  1086. X        fprintf(stderr, "LETTER\n");
  1087. X        break;
  1088. X        default:
  1089. X        fprintf(stderr, "OTHER\n");
  1090. X        break;
  1091. X        }
  1092. X        fprintf(stderr, USAGE, progname);
  1093. X        fprintf(stderr, "\t-c  Turn off coordinates\n");
  1094. X        fprintf(stderr, "\t-f  Set the font\n");
  1095. X        fprintf(stderr, "\t-g  Turn off grid\n");
  1096. X        fprintf(stderr, "\t-h  Show this text\n");
  1097. X        fprintf(stderr, "\t-l  Print large maps\n");
  1098. X        fprintf(stderr, "\t-L  Set the pagelength\n");
  1099. X        fprintf(stderr, "\t-n  Turn off map centering\n");
  1100. X        fprintf(stderr, "\t-o  Show one page centered around x,y\n");
  1101. X        fprintf(stderr, "\t-p  Set pagesize (A4,LETTER or OTHER)\n");
  1102. X        fprintf(stderr, "\t-s  Set size of square (default: %d)\n", sqsize);
  1103. X        fprintf(stderr, "\t-t  Set the title of the map\n");
  1104. X        fprintf(stderr, "\t-u  Force simple map output (just letters)\n");
  1105. X        fprintf(stderr, "\t-v  Verbose mode\n");
  1106. X        fprintf(stderr, "\t-W  Set the pagewidth\n");
  1107. X        fprintf(stderr, "\t-X  Set the X-offset\n");
  1108. X        fprintf(stderr, "\t-Y  Set the Y-offset\n");
  1109. X        exit(1);
  1110. X    case 'u':
  1111. X        maptype = FORCED;
  1112. X        break;
  1113. X    case 'o':
  1114. X        onepage = TRUE;    /* Mode one of onepage */
  1115. X        if (2 != sscanf(optarg, "%d,%d", ¢x, ¢y)) {
  1116. X        fprintf(stderr, "Error in coordinates to o-option\n");
  1117. X        exit(1);
  1118. X        }
  1119. X        break;
  1120. X    case 'l':
  1121. X        note = TRUE;
  1122. X        break;
  1123. X    case 'p':
  1124. X        setpagesize(parsepagesize(optarg));
  1125. X        break;
  1126. X    case 'n':
  1127. X        center = FALSE;
  1128. X        break;
  1129. X    case 'g':
  1130. X        grid = FALSE;
  1131. X        break;
  1132. X    case 's':
  1133. X        sscanf(optarg, "%d", &sqsize);
  1134. X        break;
  1135. X    case 'f':
  1136. X        strncpy(fontname, optarg, 80);
  1137. X        fontname[79] = '\0';
  1138. X        break;
  1139. X    case 't':
  1140. X        strncpy(title, optarg, 80);
  1141. X        title[79] = '\0';
  1142. X        break;
  1143. X    case 'v':
  1144. X        verbose = TRUE;
  1145. X        break;
  1146. X    case 'c':
  1147. X        coords = FALSE;
  1148. X        break;
  1149. X    case 'W':
  1150. X        sscanf(optarg, "%d", &pagewidth);
  1151. X        break;
  1152. X    case 'L':
  1153. X        sscanf(optarg, "%d", &pageheight);
  1154. X        break;
  1155. X    case 'X':
  1156. X        sscanf(optarg, "%d", &xoffset);
  1157. X        break;
  1158. X    case 'Y':
  1159. X        sscanf(optarg, "%d", &yoffset);
  1160. X        break;
  1161. X    default:
  1162. X        fprintf(stderr, USAGE, argv[0]);
  1163. X        exit(1);
  1164. X    }
  1165. X    if (optind < argc)
  1166. X    infile = fopen(argv[optind], "r");
  1167. X
  1168. X    if (infile == NULL) {
  1169. X    perror(progname);
  1170. X    exit(-10);
  1171. X    }
  1172. X    if (++optind < argc)
  1173. X    outfile = fopen(argv[optind], "w");
  1174. X
  1175. X    if (outfile == NULL) {
  1176. X    perror(progname);
  1177. X    exit(-10);
  1178. X    }
  1179. X    setbuf(outfile, buffer);    /* They recomended this on the net today */
  1180. X
  1181. X    if (++optind < argc) {
  1182. X    fprintf(stderr, USAGE, argv[0]);
  1183. X    exit(1);
  1184. X    }
  1185. X    /* If verbose identify program */
  1186. X
  1187. X    if (verbose)
  1188. X    fprintf(stderr, "Psmap version %s\n", VERSION);
  1189. X
  1190. X
  1191. X    /* First we check if the infile is a valid conquer map file */
  1192. X
  1193. X    if (NULL == fgets(firstline, 80, infile)) {
  1194. X    fprintf(stderr, "Empty input file\n");
  1195. X    exit(1);
  1196. X    }
  1197. X    if (0 != strncmp(firstline, MATCHSTRING, strlen(MATCHSTRING))) {
  1198. X    fprintf(stderr, "Not a Conquer Map file\n");
  1199. X    exit(1);
  1200. X    }
  1201. X    for (c = 0; c < strlen(firstline); c++) {
  1202. X    if (firstline[c] == ':')
  1203. X        break;
  1204. X    }
  1205. X
  1206. X    strncpy(foot, firstline, c);
  1207. X    foot[c] = '\0';
  1208. X    if (title[0] == '\0') {
  1209. X    strncpy(title, &firstline[c + 1], 80);
  1210. X    title[79] = '\0';
  1211. X    }
  1212. X    /* Find out which type of map it is */
  1213. X
  1214. X    if (maptype != FORCED) {
  1215. X    maptype = getmaptype(&firstline[c + 1]);
  1216. X    } else
  1217. X    maptype = SIMPLE;
  1218. X
  1219. X    if (verbose) {
  1220. X    fprintf(stderr, "Maptype is ");
  1221. X    switch (maptype) {
  1222. X    case (SIMPLE):
  1223. X        fprintf(stderr, "simple\n");
  1224. X        break;
  1225. X    case (ALTITUDES):
  1226. X        fprintf(stderr, "altitudes\n");
  1227. X        break;
  1228. X    case (DESIGNATIONS):
  1229. X        fprintf(stderr, "designations\n");
  1230. X        break;
  1231. X    case (NATIONS):
  1232. X        fprintf(stderr, "nations\n");
  1233. X        break;
  1234. X    case (VEGETATIONS):
  1235. X        fprintf(stderr, "vegetations\n");
  1236. X        break;
  1237. X    default:
  1238. X        break;
  1239. X    }
  1240. X    }
  1241. X    /* Send the first part of the postscript file to outfile */
  1242. X
  1243. X    fprintf(outfile, "%%!\n");
  1244. X    fprintf(outfile, "%% Created by conqps version %s\n\n", VERSION);
  1245. X    if (note)
  1246. X    fprintf(outfile, "\nnote\n\n");
  1247. X    fprintf(outfile, "%% Here comes the map data:\n");
  1248. X
  1249. X    /* Parse the map */
  1250. X
  1251. X    readmap();
  1252. X
  1253. X    /* Build the last part of postscript file */
  1254. X
  1255. X    buildps();
  1256. X
  1257. X    /* Phu that was it.  */
  1258. X
  1259. X    if (infile != NULL)
  1260. X    fclose(infile);
  1261. X    if (outfile != NULL)
  1262. X    fclose(outfile);
  1263. X
  1264. X    return (0);
  1265. X}
  1266. X
  1267. SHAR_EOF
  1268. chmod 0664 psmap.c || echo "restore of psmap.c fails"
  1269. set `wc -c psmap.c`;Sum=$1
  1270. if test "$Sum" != "11406"
  1271. then echo original size 11406, current size $Sum;fi
  1272. echo "x - extracting psmap.h (Text)"
  1273. sed 's/^X//' << 'SHAR_EOF' > psmap.h &&
  1274. X/*
  1275. X *   Header file for conqps   by MaF
  1276. X *   Feel free to modify
  1277. X *   Comments should be sent to d8forma@dtek.chalmers.se
  1278. X *
  1279. X */
  1280. X
  1281. X/* Page size hassle */
  1282. X#ifdef OTHER
  1283. X#define DEFAULTPAGE 0
  1284. X#endif
  1285. X
  1286. X#ifdef A4
  1287. X#define DEFAULTPAGE 1
  1288. X#endif
  1289. X
  1290. X#ifdef LETTER
  1291. X#define DEFAULTPAGE 2
  1292. X#endif
  1293. X
  1294. X/* Printer dependant entries */
  1295. X#define PAGEWIDTH_A4       540
  1296. X#define PAGEHEIGHT_A4      820
  1297. X#define XOFFSET_A4         30
  1298. X#define YOFFSET_A4         10
  1299. X
  1300. X#define PAGEWIDTH_LETTER       575
  1301. X#define PAGEHEIGHT_LETTER      760
  1302. X#define XOFFSET_LETTER         15
  1303. X#define YOFFSET_LETTER         10
  1304. X
  1305. X#define PAGEWIDTH_OTHER       450
  1306. X#define PAGEHEIGHT_OTHER      700
  1307. X#define XOFFSET_OTHER         40
  1308. X#define YOFFSET_OTHER         30
  1309. X
  1310. X/* Cosmetics */
  1311. X#define XMARGINS        30
  1312. X#define YMARGINS        50
  1313. X
  1314. X/* Version specific defines */
  1315. X#define VERSION         "1.0"
  1316. X#define USAGE           "Usage: %s [cghlnvu] [p pagesize] [f font] [o x,y] [s size]\n\t[W n] [L n] [X n] [Y n] [t title] [infile [outfile]]\n"
  1317. X#define MATCHSTRING     "Conquer Version"
  1318. X
  1319. X/* Mathematical definitions */
  1320. X#define TRUE            1
  1321. X#define FALSE           0
  1322. X
  1323. X/* Types of maps possible to be printed */
  1324. X#define SIMPLE          0
  1325. X#define ALTITUDES       1
  1326. X#define DESIGNATIONS    2
  1327. X#define NATIONS         3
  1328. X#define VEGETATIONS     4
  1329. X#define FORCED          5
  1330. SHAR_EOF
  1331. chmod 0664 psmap.h || echo "restore of psmap.h fails"
  1332. set `wc -c psmap.h`;Sum=$1
  1333. if test "$Sum" != "1310"
  1334. then echo original size 1310, current size $Sum;fi
  1335. echo "x - extracting psmap.ps (Text)"
  1336. sed 's/^X//' << 'SHAR_EOF' > psmap.ps &&
  1337. X%% Postscript part of conqps
  1338. X%% Feel free to hack in it
  1339. X%% Comments should be sent to  d8forma@dtek.chalmers.se
  1340. X
  1341. X%   This is the user variables
  1342. X
  1343. X% This is the font sizes
  1344. X/TitleFont 13 def    % For the title
  1345. X/FootFont 7 def        % For the foot texts
  1346. X/CoordFont 5 def    % For the coordinates
  1347. X/SquareFont 6 def    % For the letters inside the squares
  1348. X
  1349. X% This is the linewidth  (one unit is 1/72 inch)
  1350. X/LineWidth .3 def
  1351. X
  1352. X% This is how dark some things should be
  1353. X% 0 is black   1 is white
  1354. X/SeaCol .6 def        % Colour of seas
  1355. X/KnownCol .97 def    % Colour of known squares
  1356. X/SqTeCol 0 def        % Colour of sector symbols
  1357. X/WNCol 0.9 def        % Colour of the other pages in where square
  1358. X/WKCol 1 def        % Colour of this page in where square
  1359. X
  1360. X
  1361. X%===========================================================================
  1362. X%========== Behind these walls lures the monster called PostSript ==========
  1363. X%============== If thou should choose to enter know thy enemy ==============
  1364. X%===========================================================================
  1365. X
  1366. X% This is the size of the little box showing which map this is
  1367. X/WhereSize YMARGINS 2 div def
  1368. X
  1369. X/AdjustX
  1370. X{
  1371. X  /x exch def
  1372. X  x 0 lt { /x x largex 1 add mod def } if
  1373. X  x 0 lt { /x x largex 1 add add def } if
  1374. X  x largex gt { /x x largex 1 add mod def } if
  1375. X  x largex 1 add eq {/x 0 def} if
  1376. X  x
  1377. X} def
  1378. X
  1379. X/AdjustY
  1380. X{
  1381. X  /y exch def
  1382. X  y 0 lt { /y y largey 1 add mod def } if
  1383. X  y 0 lt { /y y largey 1 add add def } if
  1384. X  y largey gt { /y y largey 1 add mod def } if
  1385. X  y largey 1 add eq {/y 0 def} if
  1386. X   y
  1387. X} def
  1388. X
  1389. X/DoCoords
  1390. X{
  1391. X  newpath
  1392. X  font findfont CoordFont scalefont setfont
  1393. X
  1394. X  % Do Y coordiates
  1395. X  XMARGINS 2 div
  1396. X  YMARGINS .80 mul ydel sqsize mul add
  1397. X  moveto
  1398. X  ystart 1 ystart ydel add
  1399. X  {
  1400. X    /y exch AdjustY def
  1401. X    currentpoint
  1402. X    /str y (888) cvs def
  1403. X    str stringwidth pop 5 add neg 2
  1404. X    rmoveto
  1405. X    str show
  1406. X    2 copy moveto
  1407. X    xdel 1 add sqsize mul 2 add 2 rmoveto
  1408. X    str show
  1409. X    sqsize sub moveto
  1410. X  } for
  1411. X
  1412. X  % Do X coordinates
  1413. X  XMARGINS 2 div 
  1414. X  YMARGINS .80 mul CoordFont sub 2 sub
  1415. X  moveto
  1416. X  xstart 1 xstart xdel add
  1417. X  {
  1418. X    /x exch AdjustX def
  1419. X    x 0 lt { /x x largex add def } if
  1420. X    x largex 1 add gt { /x x largex 1 add sub def } if
  1421. X    currentpoint
  1422. X    /str x (888) cvs def
  1423. X    str show
  1424. X    2 copy ydel 2 add sqsize mul add 2 add moveto
  1425. X    str show
  1426. X    exch sqsize add exch moveto
  1427. X  } for
  1428. X} def
  1429. X
  1430. X/DoGrid
  1431. X{
  1432. X  newpath
  1433. X
  1434. X  % Do X-lines
  1435. X  XMARGINS 2 div
  1436. X  YMARGINS .80 mul
  1437. X  moveto
  1438. X  ystart ydel add -1 ystart 1 sub
  1439. X  {
  1440. X    pop
  1441. X    xdel 1 add sqsize mul 0
  1442. X    rlineto
  1443. X    xdel 1 add sqsize mul neg sqsize
  1444. X    rmoveto
  1445. X  } for
  1446. X
  1447. X  % Do Y-lines
  1448. X  XMARGINS 2 div
  1449. X  YMARGINS .80 mul
  1450. X  moveto
  1451. X  xstart 1 xstart xdel add 1 add
  1452. X  {
  1453. X    pop
  1454. X    0 ydel 1 add sqsize mul
  1455. X    rlineto
  1456. X    sqsize ydel 1 add sqsize mul neg
  1457. X    rmoveto
  1458. X  } for
  1459. X
  1460. X  stroke
  1461. X} def
  1462. X
  1463. X/FillSec
  1464. X{
  1465. X  sqsize 0 rlineto
  1466. X  0 sqsize rlineto
  1467. X  sqsize neg 0 rlineto
  1468. X  closepath
  1469. X  gsave
  1470. X  /old currentgray def
  1471. X  setgray
  1472. X  fill
  1473. X  old setgray
  1474. X  grestore
  1475. X  stroke
  1476. X}def
  1477. X
  1478. X/DoMap
  1479. X{
  1480. X  /NotEmpty false def
  1481. X  /c ( ) def
  1482. X  font findfont SquareFont scalefont setfont
  1483. X
  1484. X  0 1 xdel
  1485. X  {
  1486. X    /X exch def
  1487. X    0 1 ydel
  1488. X    {
  1489. X      /Y exch def
  1490. X      newpath
  1491. X      XMARGINS 2 div X sqsize mul add
  1492. X      ydel sqsize mul YMARGINS .80 mul add Y sqsize mul sub
  1493. X      moveto
  1494. X      /x X xstart add AdjustX def
  1495. X      /y Y ystart add AdjustY def
  1496. X      c 0 Map y get x get put
  1497. X      c ( ) ne
  1498. X      {
  1499. X        /NotEmpty true def
  1500. X        /NotDone true def
  1501. X    gsave
  1502. X    .01 setlinewidth
  1503. X        currentpoint
  1504. X         KnownCol FillSec
  1505. X         SqTeCol setgray
  1506. X        moveto
  1507. X    maptype (0) ne
  1508. X    {
  1509. X          c (#) eq
  1510. X          {
  1511. X            /NotDone false def
  1512. X          sqsize dup scale
  1513. X          .2 .2 rmoveto
  1514. X          .3 .6 rlineto
  1515. X          .3 -.6 rlineto
  1516. X          -.2 .4 rmoveto
  1517. X         -.2 0 rlineto
  1518. X         stroke
  1519. X          } if
  1520. X          c (^) eq
  1521. X          {
  1522. X            /NotDone false def
  1523. X         sqsize dup scale
  1524. X         .2 .2 rmoveto
  1525. X         .3 .4 rlineto
  1526. X         .2 -.4 rlineto
  1527. X         .1 0 rmoveto
  1528. X         -.1 .3 rlineto
  1529. X         -.1 -.1 rlineto
  1530. X            stroke
  1531. X          } if
  1532. X          c (%) eq
  1533. X          {
  1534. X            /NotDone false def
  1535. X         sqsize dup scale
  1536. X        currentpoint
  1537. X        translate
  1538. X        .2 .2 rmoveto
  1539. X         .4 .2 .2 180 40 arcn
  1540. X        .70 .2 moveto
  1541. X         .6 .2 .10 0 180 arc
  1542. X         stroke
  1543. X          } if
  1544. X          c (-) eq
  1545. X          {
  1546. X            /NotDone false def
  1547. X        sqsize dup scale
  1548. X          .2 .2 rmoveto
  1549. X         .6 0 rlineto
  1550. X          stroke
  1551. X          } if
  1552. X        } if
  1553. X        c (~) eq
  1554. X        {
  1555. X          /NotDone false def
  1556. X          SeaCol FillSec
  1557. X        } if
  1558. X        NotDone
  1559. X        {
  1560. X          sqsize 5 div dup rmoveto
  1561. X          c show
  1562. X        } if
  1563. X    grestore
  1564. X      } if
  1565. X    } for
  1566. X  } for
  1567. X} def
  1568. X
  1569. X
  1570. X/DoText
  1571. X{
  1572. X  font findfont TitleFont scalefont setfont
  1573. X  PAGEWIDTH title stringwidth pop sub 2 div
  1574. X  YMARGINS .4 mul TitleFont 2 div sub
  1575. X  moveto title show
  1576. X  font findfont FootFont  scalefont setfont
  1577. X  foot stringwidth pop
  1578. X  foot2 stringwidth pop
  1579. X  gt {foot} {foot2} ifelse
  1580. X  stringwidth pop
  1581. X  PAGEWIDTH exch sub dup
  1582. X  YMARGINS .4 mul
  1583. X  moveto foot show
  1584. X  YMARGINS .4 mul FootFont 1.5 mul sub
  1585. X  moveto foot2 show
  1586. X} def
  1587. X
  1588. X/DrawWhere
  1589. X{
  1590. X  1 1 xpages { 
  1591. X    /xsq exch def
  1592. X    ypages -1 1 {
  1593. X      /ysq exch def
  1594. X      newpath
  1595. X      0 0 moveto
  1596. X      /sqxsize WhereSize xpages div def
  1597. X      /sqysize WhereSize ypages div def
  1598. X      xsq sqxsize mul ypages ysq sub sqysize mul
  1599. X      rmoveto % Am now at top left of this square
  1600. X      sqxsize 0 rlineto
  1601. X      0 sqysize rlineto
  1602. X      sqxsize neg 0 rlineto
  1603. X      closepath
  1604. X      WNCol setgray
  1605. X      xsq currx eq ysq curry eq and { WKCol setgray } if
  1606. X      gsave fill grestore
  1607. X      0 setgray stroke
  1608. X    } for
  1609. X  } for
  1610. X} def
  1611. X
  1612. X/DoPage  % currx curry xstart xdel ystart  ydel
  1613. X{
  1614. X  /ydel exch def
  1615. X  /ystart exch def
  1616. X  /xdel exch def
  1617. X  /xstart exch def
  1618. X  /curry exch def
  1619. X  /currx exch def
  1620. X
  1621. X  /largey Map length 1 sub def
  1622. X  /largex Map 1 get length 1 sub def
  1623. X
  1624. X  initgraphics
  1625. X  XOFFSET YOFFSET translate
  1626. X  noteq { 0.8544 0.9304 scale 0 YMARGINS .4 mul translate} if
  1627. X  LineWidth setlinewidth
  1628. X  DoText
  1629. X  xpages 1 ne ypages 1 ne or {DrawWhere} if
  1630. X  coords {DoCoords} if
  1631. X  grid {DoGrid} if
  1632. X  DoMap
  1633. X  NotEmpty {showpage} if
  1634. X} def
  1635. SHAR_EOF
  1636. chmod 0664 psmap.ps || echo "restore of psmap.ps fails"
  1637. set `wc -c psmap.ps`;Sum=$1
  1638. if test "$Sum" != "6077"
  1639. then echo original size 6077, current size $Sum;fi
  1640. rm -f s2_seq_.tmp
  1641. echo "You have unpacked the last part"
  1642. exit 0
  1643.